/*
 * $Id$
 */
package py.windmill.action;

import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author myang
 */
public class HttpResponse implements Response {

    private HttpServletResponse _resp;
    private Request _req;

    public HttpResponse(final HttpServletResponse resp, final Request req) {
        _resp = resp;
        _req = req;
    }

    @Override
    public Response contentType(final MimeType t) {
        _resp.setContentType(t.toString());
        return this;
    }

    @Override
    public void println(final Object val) {
        try {
            _resp.getWriter().println(val);
        } 
        catch (Exception ex) {
        }
    }

    @Override
    public HttpServletResponse containerResponse() {
        return _resp;
    }

    @Override
    public Request request() {
        return _req;
    }
}
